<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div class="wrapper">
        <div class="container">
            <h2>scroll-snap-type: y <em>mandatory</em></h2>
            <ul>
                <li>Lorem, ipsum dolor.</li>
                <li>Doloremque, maxime id.</li>
                <li>Mollitia, qui beatae?</li>
                <li>Sit, fuga repellendus!</li>
                <li>Reiciendis, commodi asperiores?</li>
                <li>Dicta, deleniti tempore?</li>
                <li>Recusandae, rerum numquam.</li>
                <li>Cumque, quos eveniet?</li>
                <li>Accusamus, libero in.</li>
                <li>Reprehenderit, minus debitis.</li>
            </ul>
        </div>
        <div class="container proximity">
            <h2>scroll-snap-type: y <em>proximity</em></h2>
            <ul>
                <li>Lorem, ipsum dolor.</li>
                <li>Doloremque, maxime id.</li>
                <li>Mollitia, qui beatae?</li>
                <li>Sit, fuga repellendus!</li>
                <li>Reiciendis, commodi asperiores?</li>
                <li>Dicta, deleniti tempore?</li>
                <li>Recusandae, rerum numquam.</li>
                <li>Cumque, quos eveniet?</li>
                <li>Accusamus, libero in.</li>
                <li>Reprehenderit, minus debitis.</li>
                <li>Minima, dolores nobis?</li>
            </ul>
        </div>
    </div>

</body>
<style>
    * {
        box-sizing: border-box;
    }

    body {
        font-family: sans-serif;
    }

    .wrapper {
        display: flex;
    }

    h2 {
        position: fixed;
        text-align: center;
        font-size: 1.5rem;
        font-family: monospace;
        width: 50%;
        top: 1em;

        
    }
    h2 em {
        font-weight: bold;
    }
    .container {
        flex-basis: 50%;
        max-height: 100vh;
        overflow-y: scroll;
        border: 1px solid gray;
        /* 吸附的方式 */
        scroll-snap-type: y mandatory;
    }

    .container .proximity {
        scroll-snap-type: y proximity;
    }

    li {
        border-bottom: 1px solid white;
        padding: 3rem;
        font-size: 1.4rem;
        color: rgba(white, .5);
        background: lightgray;
        text-align: center;
        display: flex;
        flex-flow: column;
        justify-content: center;
        /* 吸附的对齐方式 */
        scroll-snap-align: start;
        /* 滑动的时候始终要停止 */
        scroll-snap-stop: always;
    }
</style>

</html>